<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@include file="checklogin.jsp"%>
<head>
	<base href="<%=basePath%>">
	<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all">
	<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="keywords" content="Spicemystery Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
	<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
	<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Libre+Baskerville:400,700' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" type="text/css" href="layui/dist/css/layui.css">
	<script type="application/javascript" src="layui/dist/layui.all.js"></script>
	<script type="application/javascript" src="js/jq.js"></script>
	<script src="bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript"  src="js/orderr.js" charset="UTF-8"></script>
	<script src="js/simpleCart.min.js"> </script>
</head>
<body>
<!-- header -->
<!-- header -->
<div class="head-top"></div>

<!-- 导航栏-->

<%@include file="header.jsp"%>
<!-- about -->
<div class="orders">
	<div class="container">
		<div style="display: none">
			<div class="order-top">
				<span style="display: none">店铺编号 </span>
				<li class="im-g"><img src="images/1p.jpg" class="img-responsive" alt=""></li>
				<li class="data"><h4>店铺名</h4>
					<P> 店铺简介</P>
				</li>
				<li class="bt-nn">
					<a class="morebtn hvr-rectangle-in" href="#">进入</a>
				</li>
				<div class="clearfix"></div>
			</div>
		</div>


	</div>
</div>
<!-- about -->
<!-- footer-->
<%@include file="footer.jsp"%>


<%@include file="modal.jsp"%>
<!-- 模态框-->

<script>
	var layer,form;
	//初始化layer对象
	layer=layui.layer;
	form=layui.form;

	// 订单函数初始化
	begin('<%=path%>');

	$.ajax({
		type: "GET",
		url: '<%=path%>/selectallshop',
		//发送查询所有店铺的请求
		dataType:'json',
		success: function (result) {
			var di=$(".order-top")
			//div中 class为order-top是店铺模板因为店铺的数量不确定所以需要clone后通过循环创建填充店铺数据的div
			//将模板保存到内容中
			$("div[class=orders] > div[class=container]").empty();
			//清空模板
			for(var i=0;i<result.data.length;i++){
				var div=di.clone();
				//每次循环都创建一个新的模板对象
				$(div).find("img").attr("src",result.data[i].shop_img_url).css({ height: "120px", width: "120px" });
				//将店铺图片的相对定位赋值给imgsrc属性
				$(div).find("h4").text(result.data[i].shop_name);
				//找到模板中的h4将店铺名填充进去
				$(div).find("p").text(result.data[i].shop_value);
				//找到p标签将店铺简介填充进去
				$(div).find("span").text(result.data[i].shop_id)
				//找到模板中的span将shopid填充进去
				$(div).find("a").attr("href","<%=path%>/turnshoppage?shop_id="+result.data[i].shop_id);
				//同样在按钮上写好链接地址,之后点击按钮时可以跳转到响应的url地址
				div.appendTo($("div[class=orders]   div[class=container]"))
				//完成后将模板插入外边大的div中

			}
		},
		error: function(data) {


		}

	});
	//点击购物车图片触发点击事件
	$("#buy").on("click",function () {
		//运行ordermenu初始化购物车函数
		ordermenu('<%=path%>')
		//给id=buybtn 的按钮触发点击事件开启模态框
		$("#buybtn").click();

	})

</script>

</body>
</html>